﻿
@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <script src="~/plugins/mzui/js/mzui.min.js"></script>
    <link href="~/plugins/mzui/css/mzui.min.css" rel="stylesheet" />
    <title>个人中心</title>
    <style>
        .profile-haeder {
            position: relative;
            overflow: hidden;
            min-height: 8rem
        }

            .profile-haeder > .back {
                top: -2rem;
                left: -2rem;
                right: -2rem;
                bottom: -2rem;
                background-position: center;
                background-size: cover
            }

            .profile-haeder > .front {
                background: rgba(0,0,0,.1);
                text-align: center;
                padding: 1.5rem
            }
    </style>
</head>
<body class="with-nav-bottom">
    <div class="heading info text-center">
        <div class="title"><div class="label success" data-display data-backdrop="true" data-target="#lv">个人中心</div></div>
    </div>
    <br/>
    <div class="section">
        <div class="list with-divider">
            <a class="item with-avatar" data-display data-backdrop="true" data-target="#grzl">
                <div class="avatar text-gray"><i class="icon-user"></i></div>
                <div class="title">修改密码</div>
                <i class="icon icon-arrow-up muted"></i>
            </a>
            <a href="/home/zcpay" class="item with-avatar">
                <div class="avatar text-gray"><i class="icon-window-alt"></i></div>
                <div class="title">
                    购买卡密
                    <span class="label label-primary label-outline red">余额 @ViewBag.ye</span>
                </div>
                <i class="icon icon-chevron-right muted"></i>
            </a>
            <a href="/shop/hyxf" class="item with-avatar">
                <div class="avatar text-gray"><i class="icon icon-gift"></i></div>
                <div class="title">卡密订单 <div class="label special outline circle">@ViewBag.wdxf</div></div>
                <i class="icon icon-chevron-right muted"></i>
            </a>
        </div>
    </div>
    <div id="grzl" class="affix dock-bottom modal">
        <div class="heading">
            <div class="title"><strong>修改密码</strong></div>
            <nav class="nav"><a data-dismiss="display"><i class="icon-remove muted"></i></a></nav>
        </div>
        <section class="section">
            <div class="box">
                <div class="control has-error">
                    <label for="pwd">当前密码</label>
                    <input id="pwd" name="pwd" type="password" class="input" placeholder="请输入当前使用的密码">
                    <p id="mm" class="help-text"></p>
                </div>
                <div class="control has-error">
                    <label for="newpwd">新密码</label>
                    <input id="newpwd" name="newpwd" type="password" class="input" placeholder="请使用不少于 6 个字符的密码">
                    <p id="xmm" class="help-text"></p>
                </div>
                <div class="control">
                    <button type="button" id="pwdok" class="btn block primary" onclick="return shoppwd();">提交</button>
                </div>
            </div>
        </section>
    </div>
    <div id="wx" class="affix dock-bottom modal hidden">
        <div class="heading">
            <div class="title"><strong>收款码(在微信+号的收付款里有你的二维码)</strong></div>
            <nav class="nav"><a data-dismiss="display"><i class="icon-remove muted"></i></a></nav>
        </div>
        <section class="section">
            <div class="box">
                <div class="control">
                    <img id="ewmimg" src="@ViewBag.ewm" onerror="this.src = '/images/nopic.png'" />
                    <p class="help-text"><input id="ewm" type="file" /></p>
                </div>
                <div class="control">
                    <button id="ewmbt" type="button" class="btn block primary" onclick="return ewm();">提交数据</button>
                </div>
            </div>
        </section>
    </div>
    <div id="tydmz" class="affix dock-bottom modal hidden">
        <div class="heading">
            <div class="title"><strong>银行帐号/店铺审核</strong></div>
            <nav class="nav"><a data-dismiss="display"><i class="icon-remove muted"></i></a></nav>
        </div>
        <section class="section">
            <div class="box">
                <div class="control">
                    <img id="dmzimg" src="@ViewBag.dmz" onerror="this.src = '/images/nopic.png'" />
                    <p class="help-text"><input id="dmz" type="file" /></p>
                </div>
                <div class="control has-label-left has-icon-right has-error">
                    <input id="khh" name="khh" type="text" class="input" placeholder="开户行" value="@ViewBag.khh">
                    <label for="khh"><i class="icon-smile"></i></label>
                    <p id="zsxm" class="help-text"></p>
                </div>
                <div class="control has-label-left has-icon-right has-error">
                    <input id="khm" name="khm" type="text" class="input" placeholder="开户人" value="@ViewBag.khm">
                    <label for="khm"><i class="icon-user"></i></label>
                    <p id="zsxm" class="help-text"></p>
                </div>
                <div class="control has-label-left has-icon-right has-error">
                    <input id="kahao" name="kahao" type="text" class="input" placeholder="银行卡号" onkeyup="value=value.replace(/[^\d]/g,'');" value="@ViewBag.kahao">
                    <label for="kahao"><i class="icon-credit"></i></label>
                    <p id="sfzmsg" class="help-text"></p>
                </div>
                <div class="control">
                    <button id="dmzbt" type="button" class="btn block primary" onclick="return dmz();">提交</button>
                </div>
            </div>
        </section>
    </div>
    <div id="lxwm" class="affix dock-bottom modal hidden">
        <div class="heading">
            <div class="title"><strong>联系我们</strong></div>
            <nav class="nav"><a data-dismiss="display"><i class="icon-remove muted"></i></a></nav>
        </div>
        <div class="section">
            <div class="box">
                <p>
                    地址：福建省福州市鼓楼区新权南路12号金福商厦708单元<br />
                    电话：0591-83307879<br />
                    惠中信网络科技（福建）有限公司
                </p>
            </div>
        </div>
    </div>
    <div id="lv" class="affix dock-bottom modal hidden">
        <div class="heading">
            <div class="title"><strong>商家升级</strong></div>
            <nav class="nav"><a data-dismiss="display"><i class="icon-remove muted"></i></a></nav>
        </div>
        <div class="section">
            <div class="box">
                <div class="control" data-dismiss="display" onclick="gopay('@ViewBag.sw');">
                    <div><div class="btn-lg warning text-center">补 @ViewBag.swpay 升级商务型</div></div>
                    <p class="help-text"></p>
                </div>
            </div>
        </div>
    </div>
    <nav class="nav affix dock-bottom justified">
        <a href="/home/kmpost">卡密验证</a>
        <a href="/logout.aspx?lx=2" class="btn primary">退出帐号</a>
    </nav>
    <script src="~/js/image.js"></script>
    <script>
        //客满
        function KM(sort) {
            $.ajax({
                url: "/shop/cpkm",
                data: "sort=" + sort,
                type: "post",
                cache: false,
                timeout: 8000,
                dataType: "json",
                ContentType: "application/json; charset=utf-8",
                error: function () { layer.msg("请求超时"); },
                beforeSend: function () { },
                success: function (data) {
                    if (data.result == 200) {
                        self.location = "/shop/index";
                    }
                    else {
                        layer.msg(data.data);
                    }
                },
            });
        }
        function shoppwd() {
            if (document.getElementById("pwd").value.length < 6) {
                document.getElementById("mm").innerHTML = "密码最少修6位";
                return false;
            }
            else {
                document.getElementById("mm").innerHTML = "";
            }
            if (document.getElementById("newpwd").value.length < 6) {
                document.getElementById("xmm").innerHTML = "密码最少修6位";
                return false;
            }
            if (document.getElementById("pwd").value == document.getElementById("newpwd").value) {
                document.getElementById("xmm").innerHTML = "新密码不能和原密码一样";
                return false;
            }
            else {
                document.getElementById("xmm").innerHTML = "";
            }
            $.ajax({
                url: "/ajax/api.ashx",
                data: "ff=shoppwd&pwd=" + document.getElementById("pwd").value + "&newpwd=" + document.getElementById("newpwd").value + "&Cache=" + Math.random(),
                type: "post",
                cache: false,
                timeout: 8000,
                dataType: "json",
                ContentType: "application/json; charset=utf-8",
                async: false,//一定要是同步请求，否则会跳转；（ajax默认是异步的）
                error: function () { document.getElementById("pwdok").innerText = "更新"; document.getElementById("pwdok").disabled = ""; alert("AJAX Error");  },
                beforeSend: function () { document.getElementById("pwdok").innerText = "提交中..."; document.getElementById("pwdok").disabled = true; },
                success: function (data) {
                    console.log(data);
                    document.getElementById("pwdok").disabled = "";
                    if (data.result == 200) {
                        document.getElementById("pwdok").innerText = "更新成功";
                    }
                    else {
                        document.getElementById("pwdok").innerText = "更新失败:" + data.data;
                    }
                },
            });
        }
        //二维码上传
        function ewm() {
            url = "/ajax/api.ashx?ff=shopewm";
            id = "ewm";
            loadImageFile(id);
        }
        //代码证上传
        function dmz() {
            url = "/ajax/api.ashx?ff=dmzfile";
            id = "dmz";
            data = {
                khh: $("#khh").val(),
                khm: $("#khm").val(),
                kahao: $("#kahao").val()
            }
            loadImageFile(id);
        }
        function gopay(gid)
        {
            $.ajax({
                    url: "/ajax/api.ashx",
                    data: "ff=gopay&lx=2&shopgid=" + gid + "&Cache=" + Math.random(),
                    type: "post",
                    cache: false,
                    timeout: 8000,
                    dataType: "json",
                    ContentType: "application/json; charset=utf-8",
                    async: false,//一定要是同步请求，否则会跳转；（ajax默认是异步的）
                    error: function () { alert("AJAX Error"); },
                    beforeSend: function () { },
                    success: function (data) {
                        if (data.appId != "payerr") {
                            WeixinJSBridge.invoke('getBrandWCPayRequest', data, function (res) {
                                switch (res.err_msg) {
                                    case "get_brand_wcpay_request:ok":
                                        self.location = "/home/msg?url=/home/denglu?lx=2&msg=升级成功,重新登录升级商家权益!";
                                        break;
                                    case "get_brand_wcpay_request:cancel":
                                        alert("你取消了支付,微信返回信息:" + res.err_msg);
                                        break;
                                    default:
                                        alert("支付失败,微信返回信息:" + res.err_msg);
                                        break;
                                }
                            });
                        }
                        else {
                            alert(data.return_msg);
                            if (data.return_msg == "登录异常")
                            {
                                self.location = "/home/denglu?lx=2";
                            }
                        }
                    },
                });
        }
    </script>
</body>
</html>
